home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / MBBSREG.SLT < prev    next >
Text File  |  1992-03-20  |  10KB  |  295 lines

  1. //-----------------------------------------------------------
  2. // MBBSREG.SL? Automatic registration to a new MBBS.
  3. //
  4. // Please look at the comments through the whole file, and modify to
  5. // suit your needs before you use it. Then recompile with CS MBBSREG. 
  6. //-----------------------------------------------------------
  7.  
  8. // If you have suggestions for improving this script, please suggest
  9. // improvements to me via old-fashioned snail-mail to:
  10.  
  11. // Author:  Inge Vabekk
  12. //          Hamangskogen 108
  13. //          N-1300 SANDVIKA
  14. //          NORWAY
  15. //          tel. (472) 546 396
  16.  
  17. str thisBBStype[]="MBBS"     // Works only for MBBS.
  18.    ,line       [80]          // Line for string storage.
  19.    ,temp        [4]          // Temporary for short strings.
  20.                              // For the Global storage:
  21.    ,global   []="GLOBAL"     // Global script.
  22.    ,bbstype  []="BTYPE"      // BBS type.
  23.    ,hprot    []="HPROT"      // Current protocol.
  24.    ,addr     []="ADDR"       // Address
  25.    ,mail     []="MAIL"       // Mail address
  26.    ,htel     []="HTEL"       // Home phone
  27.    ,wtel     []="WTEL"       // Work phone
  28.    ,passw    []="PASSW"      // Actual password
  29.    ;     
  30.  
  31. int tol = 300                // No activity for ½ minute
  32.    ,i, x                     // makes script time out.
  33.    ,stat, tmark
  34.    ;
  35.  
  36. //-----------------------------------------------------------
  37. // Script starts here.
  38. //-----------------------------------------------------------
  39.  
  40. main()
  41. {
  42.   entry();                               // Updates colors & status bar. 
  43.  
  44. // Only if online.
  45.  
  46.   if (!carrier()) 
  47.   { alarm(1);
  48.     status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  49.     return (0);
  50.   }
  51.  
  52.   call (global,"R",bbstype,line);        // Get BBS type. Should be MBBS.
  53.  
  54.   if (line != thisBBStype)
  55.   { wrongBBS();
  56.     return (-1);
  57.   }
  58.  
  59. // Start tracking incoming text.
  60.  
  61.   if (SECTION1()                         // These routines 
  62.   || SECTION2())                         // return 0 if all's OK.
  63.   { status_wind ("T²: Logon/registration failed!!",20);
  64.     return (-1);
  65.   }
  66.  
  67.   cputs ("X S ");                        // Set SuperExpert mode.
  68.   cputs ("U M Y Y Y Y N Y^M");           // Set mode; all to YES except
  69.                                          // "G&R transfer protocol
  70.   waitfor (" Command",2);                // Wait for next command.
  71.   cputs ("T ");                          // Set transfer protocol.       
  72.   output (hprot);
  73.   cputs ("AF Z;L 0^M");                  // Auto Format is Zip
  74.                                          // Set no paging,
  75.   waitfor (" Command",2);                // Wait for next command.
  76.  
  77.   cputs ("R SH^M");                      // Show conferences.
  78.   return (0);                            // continuous display
  79. }                                        // and quit to "main".
  80.  
  81. //-----------------------------------------------------------
  82. // Section 1 starts registration.
  83. //-----------------------------------------------------------
  84.  
  85. SECTION1()
  86. {
  87. int mo, ee, pw, sa, pc, hp, wp, ok;      // For tracking.      
  88.  
  89. // Start tracking messages.
  90.  
  91.   mo = track ("-more-- (Y/n",0);         // More?
  92.   ee = track (" for english) ",1);       // Enter for English
  93.   pw = track ("logon password",0);       // Please enter your logon password
  94.   cputs ("R^M");                         // We can start now.
  95.  
  96.   tmark = timer_start (tol);             // wait up to 30 sec. for 
  97.                                          // each response.
  98.   while ((stat=trig()) > 0)              // answer any logon questions
  99.   { if (stat == pw)                      // Password?
  100.     { output (passw);                    // Send it. Now we can start
  101.                                          // tracking.....
  102.       sa = track ("street address",0);   // ......street address
  103.       pc = track ("ode and town :",0);   // ......postal code and town
  104.       hp = track ("home telephone",0);   // ......home telephone number
  105.       wp = track ("work telephone",0);   // ......work telephone number
  106.       ok = track (" your answers:",0);   // Satisfied with your answers
  107.     }
  108.     else if (stat == ee)                 // Language key  
  109.       cputs ("^M");                      // ENTER for English.
  110.  
  111.     else if (stat == mo)                 // More?
  112.       cputs ("N^M");                     // No.
  113.  
  114.     else if (stat == sa)                 // Street address
  115.       output (addr);
  116.  
  117.     else if (stat == pc)                 // Postal code.
  118.       output (mail);                     // give street address.
  119.  
  120.     else if (stat == hp)                 // Home telephone number
  121.       output (htel);                     // give home phone number.
  122.  
  123.     else if (stat == wp)                 // Work telephone number
  124.       output (wtel);                     // give work phone number.
  125.  
  126.     else if (stat == ok)                 // Satisfied with answers.
  127.     { cputs ("Y^M");                     // Yes I am (satisfied).
  128.       ok = 0;                            // OK return.
  129.       break;
  130.     }
  131.   }
  132.   release();
  133.   return (ok);                           // Fail.
  134. }
  135.  
  136. //-----------------------------------------------------------
  137. // Section 2 completes registration.
  138. //-----------------------------------------------------------
  139.  
  140. SECTION2()
  141. {
  142. int pc, pw, mo, ae, lk, ml, of, mn, yl, cm, ec;   // For tracking.
  143. int em;                                           // For tracking.
  144.  
  145. // Start tracking messages.
  146.  
  147.   pw = track ("s will echo)",0);         // Password entry.
  148.   ae = track ("Type an 'AE'",0);         // Request for Æ
  149.   ml = track (" the line (Y",0);         // Middle of the line?
  150.   of = track ("or screen (Y",0);         // Disappear off your screen?
  151.   em = track ("Y) or no (N)",0);         // Easy-to-use menus etc.
  152.   yl = track ("our liking):",0);         // Not to your liking?
  153.   pc = track ("your choice ",0);         // Protocol choice.
  154.   mn = track (" MBBS (Y",0);             // Want manual?
  155.   cm = track ("(? for menu)",0);         // Command:
  156.   ec = track (" continue...",0);         // Enter to continue...
  157.  
  158.   mo = 0;
  159.  
  160.   tmark = timer_start (tol);             // Wait up to 30 sec.
  161.  
  162.   while ((stat=trig()) > 0)              // answer any logon questions.
  163.   { if (stat == pw)  
  164.     { output (passw);                    // Send password.
  165.       if (!mo)                           // Start tracking this now.
  166.         mo = track ("--more--",0);
  167.     }   
  168.     else if (stat == mo                  // more?
  169.     ||       stat == ec                  // Enter to continue?
  170.     ||       stat == mn                  // Manual?         
  171.     ||       stat == em)                 // Easy menus?     
  172.       cputs ("N^M");                     // No thanks.
  173.  
  174.     else if (stat == ae)                 // Norwegian 'Æ'
  175.       cputs("Æ");                        // Type an 'Æ'.
  176.  
  177.     else if (stat==ml                    // Middle of the line?
  178.          ||  stat==of)                   // ...disappear off the screen?         
  179.       cputs("Y^M");                      // Answer Y to ANSI.
  180.  
  181.     else if (stat == yl)                 // Rules to your liking?
  182.       cputs("Y");                        // YES. MBBS doesn't expect
  183.                                          // a CR here.
  184.     else if (stat == pc)                 // Protocol choice?
  185.       output (hprot);                    // Send protocol.
  186.  
  187.     else if (stat == cm)                 // 1.st command.   
  188.       break;
  189.   }
  190.   release();                             // Release tracks.
  191.   prints ("");
  192.   prints
  193.     ("T²: NOTE: If the system seems to 'hang' now, please press ENTER.");
  194.   prints ("");
  195.   return (0);                            // Return OK.
  196. }
  197.                                          
  198. //-----------------------------------------------------------
  199. // Wrong BBS type.
  200. //-----------------------------------------------------------
  201.  
  202. wrongBBS()
  203. {
  204. str help[48];
  205.  
  206.     failtone();                          // Alarm.    
  207.     help = "This script is for ";        // Catenate strings.
  208.     strcat (help,thisBBStype);
  209.     strcat (help," only!");
  210.     status_wind (help